package com.han.spider.safecounty.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * @Author: Hanjiafeng
 * @Date: 2020/5/23
 * @Desc:
 */
public class DateUtil {

    public static String getToday() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        return simpleDateFormat.format(calendar.getTime());
    }

    public static String getYesterday() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 1);
        return simpleDateFormat.format(calendar.getTime());
    }
}
